import React from "react";
import { createRoot } from "react-dom/client";
import "./style.css";
import TitleBar from "@/components/title-bar";
import { Router } from "./router";
import { ConfigProvider, message } from "antd";
import BeforeHandle from "./beforehandle";

message.config({
  top: 50,
  duration: 2,
  maxCount: 3,
});

function TitleProvider(props: { children: React.ReactNode }) {
  return (
    <>
      <TitleBar />
      {props.children}
    </>
  );
}

createRoot(document.getElementById("root")!).render(
  // <React.StrictMode>
  <ConfigProvider>
    <BeforeHandle>
      <TitleProvider>
        <Router />
      </TitleProvider>
    </BeforeHandle>
  </ConfigProvider>
  // </React.StrictMode>
);
